/*
   @Copyright:LeetCode
   @Author:   tjyemail
   @Problem:  http://leetcode.com/problems/maximum-depth-of-binary-tree
   @Language: C++
   @Datetime: 19-07-15 11:33
   */

/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode(int x) : val(x), left(NULL), right(NULL) {}
 * };
 */
class Solution {
public:
	int maxDepth(TreeNode* root) {
		if(root==NULL) return 0;
		return 1+max(maxDepth(root->left),maxDepth(root->right));
	}
};
